<?php 
require_once '../../../include.php';
checkLogin();
$id=$_REQUEST['id'];
$sql="select username,password,realname,departmentId,illustrate,state from admin where id=$id";
$row=fetchOne($sql);
$dsql="select id,departmentName from department order by id";
$drow=fetchAll($dsql);
?>
<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width,initial-scale=1.0">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,Chrome=1" />
	<title>修改管理员账号</title>
	<link rel="stylesheet" href="../../vender/sui/sui.min.css">
	<link rel="stylesheet" href="../../css/style.css">
	<link rel="stylesheet" href="../../css/admin.css">
</head>
<body>
<div class="content-title">
	<h4>修改管理员账号</h4>
	<a href="javascript:;" class="goback" onclick="goBack()"><<返回列表</a>
</div>
<div class="content-wrapper">
	<form id="managerEdit" class="sui-form form-horizontal sui-validate" novalidate="novalidate" method="post" action="../../doAdminAction.php?act=managerEdit&id=<?php echo $id; ?>">
	    <div class="control-group">
	      <label class="control-label">账号：</label>
	      <div class="controls">
	        <input type="text" id="username" name="username" placeholder="用户名"  class="input-fat" data-rules="required" value="<?php echo $row['username']; ?>">
	      </div>
	    </div>
		<div class="control-group">
			<label class="control-label">密码：</label>
			<div class="controls">
				<input type="password" id="password" name="password" placeholder="密码" class="input-fat" value="">
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">姓名：</label>
			<div class="controls">
				<input type="text" id="realname" name="realname" placeholder="姓名" class="input-fat" data-rules="required" value="<?php echo $row['realname']; ?>">
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">所属部门：</label>
			<div class="controls">
				<select name="departmentId" class="input-fat" data-rules="required">
	                <option value="">请选择</option>
					<?php 
						foreach ($drow as $key => $value){
							if($value['id']==$row['departmentId']){
								echo "<option value='".$value['id']."' selected>{$value["departmentName"]}</option>";
							}else{
								echo "<option value='".$value['id']."'>{$value["departmentName"]}</option>";
							}
						}
					?>
	            </select>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">描述：</label>
			<div class="controls">
				<textarea style="height: 150px;" class="input-xlarge" id="illustrate" name="illustrate"><?php echo $row['illustrate']; ?></textarea>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">启用：</label>
			<div class="controls">
				<label data-toggle="radio" class="radio-pretty inline <?php if($row['state']==1){ echo "checked";} ?>">
					<input type="radio" name="state" value="1" <?php if($row['state']==1){ echo "checked";} ?>><span>开启</span>
				</label>
				<label data-toggle="radio" class="radio-pretty inline <?php if($row['state']==0){ echo "checked";} ?>">
					<input type="radio" name="state" value="0" <?php if($row['state']==0){ echo "checked";} ?>><span>关闭</span>
				</label>
			</div>
		</div>
	    <div class="control-group">
	      <label class="control-label"></label>
	      <div class="controls">
	        <button type="submit" class="sui-btn btn-primary">保存</button>
	      </div>
	    </div>
	</form> 
</div>
</body>
</html>
<script src="../../vender/jquery/jquery-1.11.1.js"></script>
<script src="../../vender/jquery/jquery.alerts.js"></script>
<script src="../../vender/sui/sui.js"></script>
<script src="../../scripts/admin.js"></script>
<script src="../../scripts/manager/manager.js"></script>